Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add possibility to just use a parser on a per call basis #35

Merged
merged 1 commit into from Apr 17, 2012

Conversation

phoet
Copy link
Contributor

@phoet phoet commented Mar 2, 2012

No description provided.

@mbleigh
Copy link
Member

mbleigh commented Mar 16, 2012

What's the use case of per-call JSON? I'm not aware of considerations that would vary within the same app...

@phoet
Copy link
Contributor Author

phoet commented Mar 16, 2012

we are using couch_potato and tire in our application. couch_potato uses JSON.create_id = 'ruby_class' to store the type of documents in the couch. tire on the other hand uses the ruby_class attribute in an incompatibile way to store index metadata. so currently we are swapping the json engine for specific calls like this:

    def state
      # WORKAROUND (ps) json-gem in combination with JSON.create_id = 'ruby_class' fails in here
      engine = MultiJson.engine
      MultiJson.engine = :yajl
      @response = Tire::Configuration.client.get("#{Tire::Configuration.url}/_cluster/state")
      MultiJson.decode(@response.body)
    ensure
      MultiJson.engine = engine
    end

i know that we could also use the Yajl::Parser directly, but i thought it would be neat to do it on a per call basis.

@mbleigh
Copy link
Member

mbleigh commented Mar 16, 2012

That makes sense, and an :engine option seems to be the right way to do it. Can you update your fork to be compatible with the latest HEAD?

@phoet
Copy link
Contributor Author

phoet commented Mar 16, 2012

hope i resolved the conflicts properly :]

@phoet
Copy link
Contributor Author

phoet commented Apr 16, 2012

@mbleigh do you still want to pull this?

@mbleigh
Copy link
Member

mbleigh commented Apr 16, 2012

Yes I do, can you fix it to latest once more? Sorry for the delay.

@phoet
Copy link
Contributor Author

phoet commented Apr 16, 2012

started from scratch on latest master

mbleigh pushed a commit that referenced this pull request Apr 17, 2012
add possibility to just use a parser on a per call basis
@mbleigh mbleigh merged commit 25b8deb into intridea:master Apr 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants